<?php

require_once("../function/connection.php");
$email = stripcslashes($_POST['email']);


connection();

$query = "SELECT `USE_PASSWORD` FROM `user` where `USE_EMAIL` = '$email'; ";

$result2 = mysql_query($query);
$row = mysql_fetch_assoc($result2);
$haslo = $row['USE_PASSWORD'];

$content = "Twoj login to: '$email' oraz haslo to: '$haslo'";
$header = "From: WARSZTACIK - HASŁO \nContent-Type:" .
        ' text/plain;charset="iso-8859-2"' .
        "\nContent-Transfer-Encoding: 8bit";
if (mail($email, 'Zapomniane haslo', $content, $header)) {
    header('Location: /');
    $_SESSION['jgrowl'] = 'Mail został wysłany';
} else {
    session_start();
    header('Location: /');
    $_SESSION['jgrowl'] = 'Błąd serwera wysyłającego wiadomość.';
}
?>